﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;

namespace WLYT.Application.Interfaces
{
    public interface IBaseService<T> where T : class, new()
    {

        Task<bool> AddAsync(T entity);

        Task<bool> DeleteAsync(int id);

        Task<bool> DeleteAsync(string ids);

        Task<bool> DeleteAsync(string[] ids);

        Task<bool> UpdateAsync(T entity);

        Task<T> GetByIdAsync(int id);

        Task<Tuple<IList<T>, int>> GetPageListAsync(Expressionable<T> whereExpression, int pageSize, int pageIndex, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Desc);
        
        Task<Tuple<IList<T>, int>> GetPageListAsync(Expression<Func<T, bool>> whereExpression, int pageSize, int pageIndex, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Desc);

        Task<Tuple<IList<T>, int>> GetPageListAsync(List<IConditionalModel> conditionalList, int pageSize, int pageIndex, Expression<Func<T, object>> orderByExpression = null, OrderByType orderByType = OrderByType.Desc);

    }
}
